<?php

class MGiaoVien extends CI_Model
{
	function danhsachgiaovien($magv)
	{
		$this->db->where('hienthi', 'true');
		$this->db->order_by('magv', 'asc');
		return $this->db->get('giaovien', 8, 0)->result();
	}
	
	function thongtingiaovien($magv)
	{
		$this->db->where('magv', $magv);
		return $this->db->get('giaovien')->row();
	}
	
	function danhsachgiaovienlaunhat()
	{
		$this->db->order_by('magv', 'asc');
		$this->db->where('hienthi', 'true');
		return $this->db->get('giaovien', 2, 0)->result();
	}
	
	function xoagv($magv)
	{
		$this->db->where('magv', $magv);
		$this->db->delete('giaovien');
	}
	
	function themgv($tengv, $ngaysinh, $hinh, $mota, $hienthi)
	{
		$this->db->set('tengv', $tengv);
		$this->db->set('ngaysinh', $ngaysinh);
		$this->db->set('hinh', $hinh);
		$this->db->set('mota', $mota);
		$this->db->set('hienthi', $hienthi);
		$this->db->insert('giaovien');
	}
	
	function capnhatgv($magv, $tengv, $ngaysinh, $hinh, $mota, $hienthi)
	{
		$this->db->where('magv', $magv);
		$this->db->set('tengv', $tengv);
		$this->db->set('ngaysinh', $ngaysinh);
		$this->db->set('hinh', $hinh);
		$this->db->set('mota', $mota);
		$this->db->set('hienthi', $hienthi);
		$this->db->update('giaovien');
	}
	
	function danhsachgv()
	{
		
				
		return $this->db->get('giaovien')->result();
	}
}
?>